from celery_tasks.main import celery_app
from celery_tasks.sms import constants
from celery_tasks.sms.yuntongxun.sms_code import CCP


# 使用装饰器装饰异步任务，保证celery识别任务
@celery_app.task(name='send_sms_code')
def send_sms_code(mobile, sms_code):
    '''
    :param mobile:
    :param sms_code:
    :return: 成功0 失败1
    '''
    send_ret = CCP().send_message(constants.SEND_SMS_TEMPLATE_ID, mobile,(sms_code, constants.SMS_CODE_REDIS_EXPIRES // 60))
    return send_ret
